wayland: Survive without primary selection
authorMatthias Clasen <mclasen@redhat.com>
Sat, 27 Feb 2016 00:41:25 +0000 (19:41 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 27 Feb 2016 00:48:05 +0000 (19:48 -0500)
I am testing GTK+ master against mutter 3.19.90, so I'd
like GTK+ to survive even when the compositor does not
support the primary selection interface.

gdk/wayland/gdkdevice-wayland.c
gdk/wayland/gdkselection-wayland.c

index e093bc0b57be65ce32c85860414b5762983d6c15..9b085ad35a38d99f169d4d11a3e65ed06ef02d8e 100644 (file)
@@ -2920,11 +2920,14 @@ _gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
   wl_seat_add_listener (seat->wl_seat, &seat_listener, seat);
   wl_seat_set_user_data (seat->wl_seat, seat);
 
-  seat->primary_data_device =
-    gtk_primary_selection_device_manager_get_device (display_wayland->primary_selection_manager,
-                                                     seat->wl_seat);
-  gtk_primary_selection_device_add_listener (seat->primary_data_device,
-                                             &primary_selection_device_listener, seat);
+  if (display_wayland->primary_selection_manager)
+    {
+      seat->primary_data_device =
+        gtk_primary_selection_device_manager_get_device (display_wayland->primary_selection_manager,
+                                                         seat->wl_seat);
+      gtk_primary_selection_device_add_listener (seat->primary_data_device,
+                                                 &primary_selection_device_listener, seat);
+    }
 
   seat->data_device =
     wl_data_device_manager_get_data_device (display_wayland->data_device_manager,
index 9fcb31360c30edb3d19d947124a64b81afc21e93..eff802eec2634c8bc90550f0af856aba280ba8dc 100644 (file)
@@ -1089,10 +1089,13 @@ gdk_wayland_selection_get_data_source (GdkWindow *owner,
 
   if (selection == atoms[ATOM_PRIMARY])
     {
-      source = gtk_primary_selection_device_manager_create_source (display_wayland->primary_selection_manager);
-      gtk_primary_selection_source_add_listener (source,
-                                                 &primary_source_listener,
-                                                 wayland_selection);
+      if (display_wayland->primary_selection_manager)
+        {
+          source = gtk_primary_selection_device_manager_create_source (display_wayland->primary_selection_manager);
+          gtk_primary_selection_source_add_listener (source,
+                                                     &primary_source_listener,
+                                                     wayland_selection);
+        }
     }
   else
     {